﻿@model ProductEmailAFriendModel
@inject IPageHeadBuilder pagebuilder
@{
    Layout = "_SingleColumn";

    //title
    pagebuilder.AddTitleParts(Model.ProductName);
    pagebuilder.AddTitleParts(Loc["Title.ProductEmailAFriend"]);
}
<div class="page email-a-friend-page">
    <h1 class="h2 text-center generalTitle">
        <div>@Loc["Products.EmailAFriend.Title"]</div>
    </h1>
    <div class="mb-3">
        <h4 class="mb-0">
            <a href="@Url.RouteUrl("Product", new { SeName = Model.ProductSeName })" class="product">@Model.ProductName</a>
        </h4>
        @if (Model.SuccessfullySent)
        {
            <div class="alert alert-info my-3 text-center result">
                @Model.Result
            </div>
        }
        else
        {
            <form asp-route="ProductEmailAFriend" method="post" v-on:submit.prevent="validateBeforeSubmit($event)">
                <div asp-validation-summary="All" class="message-error"></div>
                <div class="form-fields">
                    <div class="form-group">
                        <label asp-for="FriendEmail" class="col-form-label">@Loc["Products.EmailAFriend.FriendEmail"]:</label>
                        <input asp-for="FriendEmail" class="form-control friend-email"
                               v-validate="'required|email'" placeholder="@Loc["Products.EmailAFriend.FriendEmail.Hint"]"/>
                        <span class="field-validation-error">{{veeErrors.first('FriendEmail')}}</span>
                        <span asp-validation-for="FriendEmail"></span>
                    </div>
                    <div class="form-group">
                        <label asp-for="YourEmailAddress" class="col-form-label">@Loc["Products.EmailAFriend.YourEmailAddress"]:</label>
                        <input asp-for="YourEmailAddress" class="form-control your-email" v-validate="'required|email'" placeholder="@Loc["Products.EmailAFriend.YourEmailAddress.Hint"]"/>
                        <span class="field-validation-error">{{veeErrors.first('YourEmailAddress')}}</span>
                        <span asp-validation-for="YourEmailAddress"></span>
                    </div>
                    <div class="form-group">
                        <label asp-for="PersonalMessage" class="col-form-label">@Loc["Products.EmailAFriend.PersonalMessage"]:</label>
                        <textarea asp-for="PersonalMessage" class="form-control your-email" placeholder="@Loc["Products.EmailAFriend.PersonalMessage.Hint"]" v-validate="'required'"></textarea>
                        <span class="field-validation-error">{{veeErrors.first('PersonalMessage')}}</span>
                        <span asp-validation-for="PersonalMessage"></span>
                    </div>
                    @if (Model.DisplayCaptcha)
                    {
                        <div class="captcha-box">
                            <captcha/>
                        </div>
                    }
                </div>
                <div class="btn-group">
                    <input type="submit" name="send-email" class="btn btn-secondary send-email-a-friend-button" value="@Loc["Products.EmailAFriend.Button"]"/>
                </div>
            </form>
        }
    </div>
</div>